﻿@using NITASA.Areas.Admin.Helper
@using NITASA.Services.Security
@{
    IAclService aclService = (IAclService)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IAclService));

    var temp = aclService.GetAll();
    int i = 0;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title :: NITASA CMS</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,800" />
    <meta charset="utf-8" />
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
    <link href="@Url.Content("~/Areas/Admin/assets/css/application.css")" media="screen" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/gridmvc.css")" type="text/css" rel="stylesheet" />
    <link href="@Url.Content("~/Areas/Admin/assets/css/custom.css")" media="screen" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Areas/Admin/assets/css/bootstrap-timepicker.min.css")" rel="stylesheet" />
    <link href="@Url.Content("~/Areas/Admin/assets/css/jquery-ui-1.10.4.custom.min.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Areas/Admin/assets/js/jquery-1.4.1-vsdoc.js")"></script>
    <!--[if lt IE 9]>
        <script src="@Url.Content("~/Areas/Admin/assets/js/html5shiv.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Areas/Admin/assets/js/excanvas.js")" type=4"text/javascript"></script>
    <![endif]-->
    @RenderSection("PageLevelStyles", false)
    <link rel="icon" type="image/png" href="~/Areas/Admin/assets/images/favicon.ico" />
</head>
<body>
    <div id="page">
        <div class="navbar navbar-top navbar-inverse">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <div>
                        <a class="brand" href="@Url.Action("Dashboard","Home")">
                            <img src="@Url.Content("~/Areas/Admin/assets/images/logo.png")" alt="logo" style="padding-top: 7px;" />
                        </a>
                    </div>
                    <ul class="nav pull-right">
                        <li class="toggle-primary-sidebar hidden-desktop" data-toggle="collapse" data-target=".nav-collapse-primary">
                            <a><i class="icon-th-list"></i></a>
                        </li>
                        <li class="collapsed hidden-desktop" data-toggle="collapse" data-target=".nav-collapse-top">
                            <a><i class="icon-cogs"></i></a>
                        </li>
                    </ul>
                    <div class="nav-collapse nav-collapse-top">
                        <ul class="nav full pull-right" style="margin-top: 10px;">
                            <li class="dropdown user-avatar">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                    <span>

                                        <img class="menu-avatar" src="@Url.Content("~/" + Functions.GetUserProfilePhoto())" />
                                        <span class="user-on-name">
                                            @Functions.GetUserName()
                                            <i class="icon-caret-down"></i>
                                        </span>
                                    </span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li class="with-image">
                                        <div class="avatar">
                                            <img src="@Url.Content("~/" + Functions.GetUserProfilePhoto())" />
                                        </div>
                                        <span>
                                            @Functions.GetUserName()
                                        </span>
                                    </li>
                                    <li class="divider"></li>
                                    <li><a href="@Url.Action("Details", "Profile")"><i class="icon-user"></i><span>Profile</span></a></li>
                                    <li><a href="@Url.Action("ChangePassword", "Profile")"><i class="icon-lock"></i><span>Change Password</span></a></li>
                                    <li><a href="@Url.Action("logout", "Authenticate")"><i class="icon-off"></i><span>Logout</span></a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="sidebar-background">
            <div class="primary-sidebar-background">
            </div>
        </div>
        @RenderBody()
    </div>
    <div class="primary-sidebar">
        <!-- Main nav -->
        <ul class="nav nav-collapse collapse nav-collapse-primary">
            @if (aclService.HasRight(Rights.ShowDashboard))
            {
                <li class="active">
                    <span class="glow"></span>
                    <a href="@Url.Action("Dashboard", "Home")">
                        <i class="icon-dashboard icon-1x"></i>
                        <span>Dashboard</span>
                    </a>
                </li>
            }
            @if (aclService.HasRight(Rights.ViewAllPosts) || aclService.HasRight(Rights.ViewUnPublishedPosts) || aclService.HasRight(Rights.CreateNewPosts))
            {
                <li class="dark-nav ">
                    <span class="glow"></span>
                    <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancPostLink">
                        <i class="icon-book icon-1x"></i>
                        <span>
                            Posts
                            <i class="icon-caret-down"></i>
                        </span>

                    </a>
                    <ul id="ancPostLink" class="collapse ">
                        @if (aclService.HasRight(Rights.ViewAllPosts) || aclService.HasRight(Rights.ViewUnPublishedPosts))
                        {
                            <li class="">
                                <a href="@Url.Action("List", "Post")">
                                    <i class="icon-folder-open-alt"></i>Browse Post
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.CreateNewPosts))
                        {
                            <li class="">
                                <a href="@Url.Action("Add", "Post")">
                                    <i class="icon-plus-sign-alt"></i>New Post
                                </a>
                            </li>
                        }
                        <li class="">
                            <a href="@Url.Action("List", "Category")">
                                <i class="icon-tags icon-1x"></i>Categories
                            </a>
                        </li>
                        <li class="">
                            <a href="@Url.Action("List", "Label")">
                                <i class="icon-tags icon-1x"></i>Labels
                            </a>
                        </li>
                    </ul>
                </li>
            }
            @if (aclService.HasRight(Rights.ViewAllPages) || aclService.HasRight(Rights.ViewUnPublishedPages) || aclService.HasRight(Rights.CreateNewPages))
            {
                <li class="dark-nav ">
                    <span class="glow"></span>
                    <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancPageLink">
                        <i class="icon-tasks icon-1x"></i>
                        <span>
                            Pages
                            <i class="icon-caret-down"></i>
                        </span>

                    </a>
                    <ul id="ancPageLink" class="collapse ">
                        @if (aclService.HasRight(Rights.ViewAllPages) || aclService.HasRight(Rights.ViewUnPublishedPages))
                        {
                            <li class="">
                                <a href="@Url.Action("List", "Page")">
                                    <i class="icon-folder-open-alt"></i>Browse Page
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.CreateNewPages))
                        {
                            <li class="">
                                <a href="@Url.Action("Add", "Page")">
                                    <i class="icon-plus-sign-alt"></i>New Page
                                </a>
                            </li>
                        }
                    </ul>
                </li>
            }
            @if (aclService.HasRight(Rights.ViewAllAddons) || aclService.HasRight(Rights.ViewUnPublishedAddons) || aclService.HasRight(Rights.CreateNewAddons))
            {
                <li class="dark-nav ">
                    <span class="glow"></span>
                    <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancAddOnsLink">
                        <i class="icon-hdd icon-1x"></i>&nbsp;
                        <span>
                            Addons
                            <i class="icon-caret-down"></i>
                        </span>

                    </a>
                    <ul id="ancAddOnsLink" class="collapse ">
                        @if (aclService.HasRight(Rights.ViewAllAddons) || aclService.HasRight(Rights.ViewUnPublishedAddons))
                        {
                            <li class="">
                                <a href="@Url.Action("List", "Addons")">
                                    <i class="icon-folder-open-alt"></i>&nbsp;Browse Addons
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.CreateNewAddons))
                        {
                            <li class="">
                                <a href="@Url.Action("Add", "Addons")">
                                    <i class="icon-plus-sign-alt"></i>&nbsp;New Addon
                                </a>
                            </li>
                        }
                    </ul>
                </li>
            }
            <li class="dark-nav ">
                <span class="glow"></span>
                <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancAppearanceLink">
                    <i class="icon-eye-open icon-1x"></i>
                    <span>
                        Appearance
                        <i class="icon-caret-down"></i>
                    </span>
                </a>
                <ul id="ancAppearanceLink" class="collapse ">
                    <li class="">
                        <a href="@Url.Action("List", "Menus")">
                            <i class="icon-sitemap"></i>&nbsp;Menu
                        </a>
                    </li>
                    <li class="">
                        <a href="@Url.Action("List", "Widget")">
                            <i class="icon-plus-sign-alt icon-1x"></i>&nbsp;Widget
                        </a>
                    </li>
                    <li class="">
                        <a href="@Url.Action("List", "Theme")">
                            <i class="icon-plus-sign-alt icon-1x"></i>&nbsp;Themes
                        </a>
                    </li>
                    <li class="">
                        <a href="@Url.Action("List", "slider")">
                            <i class="icon-film icon-1x"></i>&nbsp;Sliders
                        </a>
                    </li>
                </ul>
            </li>
            <li class="dark-nav ">
                <span class="glow"></span>
                <a href="@Url.Action("list", "media")">
                    <i class="icon-picture icon-1x"></i>
                    <span>Media Manager </span>
                </a>
            </li>
            <li class="dark-nav ">
                <span class="glow"></span>
                <a href="@Url.Action("list", "comment")">
                    <i class="icon-comments icon-1x"></i>
                    <span>Comments </span>
                </a>
            </li>
            @*<li class="dark-nav ">
                    <span class="glow"></span>
                    <a href="@Url.Action("list", "Plugin")">
                        <i class="icon-picture icon-1x"></i>
                        <span>Plugins </span>
                    </a>
                </li>*@
            @*@{ Html.RenderPartial("~/Areas/CMSAdmin/Views/Shared/RenderPluginMenu.cshtml"); }*@
            @if (aclService.HasRight(Rights.ViewUsers) || aclService.HasRight(Rights.CreateNewUsers) || aclService.HasRight(Rights.ViewRoles) || aclService.HasRight(Rights.CreateNewRoles))
            {
                <li class="dark-nav ">
                    <span class="glow"></span>
                    <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancSecurityLink">
                        <i class="icon-user-md icon-1x"></i>
                        <span>
                            User Manager
                            <i class="icon-caret-down"></i>
                        </span>
                    </a>
                    <ul id="ancSecurityLink" class="collapse ">
                        @if (aclService.HasRight(Rights.ViewUsers))
                        {
                            <li class="">
                                <a href="@Url.Action("List", "User")">
                                    <i class="icon-folder-open-alt"></i>&nbsp;Browse User
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.CreateNewUsers))
                        {
                            <li class="">
                                <a href="@Url.Action("Add", "User")">
                                    <i class="icon-plus-sign-alt"></i>&nbsp;New User
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.ViewRoles))
                        {
                            <li class="">
                                <a href="@Url.Action("List", "Role")">
                                    <i class="icon-folder-open-alt"></i>&nbsp;Browse Role
                                </a>
                            </li>
                        }
                        @if (aclService.HasRight(Rights.CreateNewRoles))
                        {
                            <li class="">
                                <a href="@Url.Action("Add", "Role")">
                                    <i class="icon-plus-sign-alt"></i>&nbsp;New Role
                                </a>
                            </li>
                        }
                    </ul>
                </li>
            }
            @if (aclService.HasRight(Rights.ManageSettings))
            {
                <li class="">
                    <span class="glow"></span>
                    <a href="@Url.Action("index", "setting")">
                        <i class=" icon-cogs icon-1x"></i>
                        <span>Settings</span>
                    </a>
                </li>
            }
            @if (aclService.HasRight(Rights.ManageTemplates))
            {
                <li class="">
                    <span class="glow"></span>
                    <a href="@Url.Action("index", "template")">
                        <i class=" icon-cog icon-1x"></i>
                        <span>Template</span>
                    </a>
                </li>
            }

            <li class="dark-nav ">
                <span class="glow"></span>
                <a class="accordion-toggle collapsed " data-toggle="collapse" href="#ancToolsLink">
                    <i class="icon-wrench icon-1x"></i>
                    <span>
                        Tools
                        <i class="icon-caret-down"></i>
                    </span>
                </a>
                <ul id="ancToolsLink" class="collapse ">
                    <li class="">
                        <a href="@Url.Action("List", "BackupRestore")">
                            <i class="icon-plus-sign-alt"></i>&nbsp;Backup/Restore
                        </a>
                    </li>
                    @* <li class="">
                            <a href="@Url.Action("Add", "Restore")">
                                <i class="icon-plus-sign-alt icon-1x"></i>&nbsp;Restore
                            </a>
                        </li>*@
                    <li class="">
                        <a href="@Url.Action("Generate", "Sitemap")">
                            <i class="icon-sitemap icon-1x"></i>&nbsp;Generate Sitemap
                        </a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>

    <script src="@Url.Content("~/Areas/Admin/assets/js/application.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/Admin/assets/js/slideManu.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/Admin/assets/js/Custom.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/Admin/assets/js/jquery.validate.min.js")"></script>
    <script src="@Url.Content("~/Areas/Admin/assets/js/jquery.validate.unobtrusive.min.js")"></script>
    <script src="@Url.Content("~/Scripts/gridmvc.min.js")"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.collapse').collapse({ toggle: false });

            $('body').on('click', '[data-toggle=collapse]', function (e) {
                e.preventDefault();
                var parent_id = $(this).data('parent');
                var test = $(parent_id + ' .nav-collapse .collapse.in').length;
                $(parent_id + ' .nav-collapse .collapse.in').collapse('hide');

                var $target = $(this).parents('.dark-nav').find('.collapse');
                $target.collapse('toggle');
            });
            $("input,select").focus(function () {
                if (!$(this).hasClass("datepicker")) {
                    //console.log("focus");
                    $("input.datepicker").datepicker('hide');
                }
            });
            //$('textarea').autogrow();
        });
        function ValidateRegex(value) {
            var reg = /^[A-Za-z0-9\ _.#&*+-]*$/
            if (reg.test(value))
                return true;
            else
                return false;
        }
    </script>
    @RenderSection("BottomScript", false)
</body>
</html>